package com.candy.shopproduct.controller;

import com.candy.entity.Product;
import com.candy.shopproduct.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    ProductService productService;
    @GetMapping("/product/{pid}")
    public Product getProductById(@PathVariable("pid") Integer pid){
        System.out.println("查询商品的信息...");
        return productService.getProductById(pid);
    }

    @RequestMapping("/editProductStock")
    public String editProductStock(Integer pid){
        productService.eidtProductStock(pid);
        return "商品库存-1";
    }


}
